package com.gzmpc.kafka.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * @author:lizhicheng
 * @email:lizhicheng@gzmpc.com
 * @date:2024-03-22 16:10:23
 */
public class DateUtil {
    public static Date randomDate(){

        Random random = new Random();

        int hour = random.nextInt(24);
        int minute = random.nextInt(60);
        int second = random.nextInt(60);
        int millisecond = random.nextInt(1000);

        String format = String.format("%02d:%02d:%02d.%03d", hour, minute, second, millisecond);
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS");
        Date date = sdf.parse(format, new java.text.ParsePosition(0));
        return date;
    }
}
